home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Directorty Opus 5 - Magellan
/
Opus 5 - Magellan.iso
/
Extras
/
D51_NUSource
/
Source
/
Routines
/
OpenLibraries.s
< prev
next >
Wrap
Text File
|
1995-08-02
|
3KB
|
75 lines
*= Open Libraries =********************************************= 15-Apr-95 =*
* Opens Libraries using the structure from the Variables Mem. *
* Beware: this routine does not check if it has already been run! *
* Temp001 = Stores current posn in INPUT struct. *
* Temp002 = Stores current posn in OUTPUT struct. *
*===========================================================================*
* Error will always result in a requester, unless Force_To_Shell is set at *
* Assembly time, in which case error messages go to the shell. *
*****************************************************************************
Open_Libraries
BClr #SF1_OpnLibErr,STD_F_1(a5) Just in case!
Lea LibData_Start(pc),a0 Start of struc w/ name-ptrs and ver#s
Move.l a0,Temp001(a5)
Lea LibBases_Start(a5),a0 Start of struc to write Base-Adrs to.
Move.l a0,Temp002(a5)
Bsr.s OpnLib_MainLoop Do the main openning routine.
BTst #SF1_OpnLibErr,STD_F_1(a5) Any problems?
Bne OpnLib_Error YES = Call special error rtn.
RTS NO = Return.
OpnLib_MainLoop
Move.l Temp002(a5),a0
Lea LibBases_Finish(a5),a4
Cmp.l a4,a0 All libraries been openned?
Blt.s OL_Skp1
RTS If so, routine done.
OL_Skp1 Move.l Temp001(a5),a0
Lea LibNames_Start(pc),a1 -._ Point to the name of
Add.l (a0)+,a1 -' the lib to be openned.
Move.l (a0)+,d0 Version of lib to be openned.
Move.l a0,Temp001(a5) Store updated pointer.
N_CallExec OpenLibrary Attempt to open the library.
Tst.l d0 If failed, set flag as such.
Bne.s OL_Skp2
BSet #SF1_OpnLibErr,STD_F_1(a5)
OL_Skp2 Move.l Temp002(a5),a0 -._ Store base adr ptr,
Move.l d0,(a0)+ -' or a NULL if failed.
Move.l a0,Temp002(a5) Store updated pointer.
Bra.s OpnLib_MainLoop Do the rest of the struct.
IFND No_Requesters
INCLUDE ASM:Source/Routines/OpenLibraries_Error_Req.s
ELSE
INCLUDE ASM:Source/Routines/OpenLibraries_Error_Shell.s
ENDC
*= Close Libraries =*******************************************= 15-Apr-95 =*
* Closes Libraries which were openned using Open_Libraries. *
*****************************************************************************
Close_Libraries
Lea LibBases_Start(a5),a3 Start of struc w/ Base-Adrs.
CloseLibs_MainLoop
Lea LibBases_Finish(a5),a4
Cmp.l a4,a3 All libraries been checked?
Blt.s CLibs_Skp1
RTS If so, exit.
CLibs_Skp1
Tst.l (a3)+ Does this lib need closing?
Beq.s CloseLibs_MainLoop If not, skip past it.
Move.l -4(a3),a1 Base pointer to a1 for CloseLib
Move.l #0,-4(a3) Null the base pointer.
Move.l a3,-(SP) -.
N_CallExec CloseLibrary |- Close the lib.
Move.l (SP)+,a3 -'
Bra.s CloseLibs_MainLoop Do next library...